package com.topisv.tms.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.ShopSource;

public interface ShopSourceDao extends PagingAndSortingRepository<ShopSource, Long>,
		JpaSpecificationExecutor<ShopSource> {

	ShopSource findByYhdStoreId(String yhdStoreId);
	List<ShopSource> findByCustomerCode(String customerCode);
	
	List<ShopSource> findByOrdenoSourceCode(String ordenoSourceCode);
	
	List<ShopSource> findByCustomerCodeAndOrdenoSourceCode(String customerCode,String ordenoSourceCode);
	
	ShopSource findByShopCode(String shopCode);

	
	ShopSource findByHtShopId(String htShopId);
	
	ShopSource findByShopName(String shopNam);
	
	ShopSource findByJdKeyAndJdSecret(String jdKey,String jdSecret);
	
	ShopSource findByTopisvNick(String topisvNick);
	
	ShopSource findByTopisvCode(String topisvCode);
	
	@Query("select s from ShopSource s where guaranteeStatus='yes'")
	List<ShopSource> findByGuaranteeStatus();
	
	@Query("select s from ShopSource s where customerCode=?1 and guaranteeStatus='yes'")
	List<ShopSource> findByGuaranteeStatusAndCustomerCode(String customerCode);
	
	@Query("select s.shopCode from ShopSource s where customerCode='MID' and guaranteeStatus='yes'")
	List<String> findByShopCodes();

}
